<template>
  <div id="moban">  
    <div  style="display:flex;margin-bottom:10px;align-items: center;">
            <img class="top_img" src="@/assets/images/a8.png" style="width:35px;height:35px;margin-right:10px;"/>
            <div style="line-height: 40px;font-weight:bold:">详细列表</div>
     </div> 
    <el-form ref="form" :model="form" label-width="70px">  
    <div style="display:flex;">
          <el-form-item  label="查询项" label-width="60px">
              <el-select  v-model="search_lx1" placeholder="请选择搜索"  style="width:140px;">
                  <el-option  v-for="(item,index) in select_data_type1" :key="index" :label="item.name" :value="item.id"></el-option>
              </el-select>
          </el-form-item> 
          <el-row v-if="search_lx1 == 1" style="display:flex;">
              <el-form-item label="用户类别" style="margin-left:10px;">
                    <el-select  v-model="form.select_num" placeholder="用户类别" style="width:140px;">
                        <el-option  v-for="(item,index) in select_data" :key="index" :label="item.name" :value="item.id"></el-option>
                    </el-select>
              </el-form-item>

              <el-form-item label="手机号码" style="margin-left:10px;">
                <el-input v-model="form.phone" placeholder="姓名/手机号" style="width:140px;"></el-input>
              </el-form-item>    
          </el-row>
          <el-row v-if="search_lx1 == 2" style="display:flex;"> 
              <el-form-item :label="variable_name1 +'区间'" label-width="80px">
                    <div style="display: flex;">
                        <el-input class="el-input-box" style="padding: 0 !important;" v-model.number="form.kmb_min" placeholder=""></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input class="el-input-box"  style="padding: 0 !important;" v-model.number="form.kmb_max" placeholder=""></el-input>
                    </div>
              </el-form-item> 
              <el-form-item :label="variable_name2 +'区间'" label-width="80px" >
                    <div style="display: flex;">
                        <el-input class="el-input-box"  v-model.number="form.gdb_min" placeholder=""></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input class="el-input-box"  v-model.number="form.gdb_max" placeholder=""></el-input>
                    </div>
              </el-form-item> 

               <el-form-item :label="variable_name3 +'区间'" label-width="80px" >
                    <div style="display: flex;">
                        <el-input  v-model.number="form.jz1" placeholder="" disabled></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input   v-model.number="form.jz2" placeholder="" disabled></el-input>
                    </div>
              </el-form-item>

               <el-form-item label="蜂巢持有" label-width="80px" >
                    <div style="display: flex;">
                        <el-input  v-model.number="form.cy1" placeholder="" disabled></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input   v-model.number="form.cy2" placeholder="" disabled></el-input>
                    </div>
              </el-form-item>
               <el-form-item label="蜂巢产出" label-width="80px" >
                    <div style="display: flex;">
                        <el-input  v-model.number="form.cc1" placeholder="" disabled></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input   v-model.number="form.cc2" placeholder="" disabled></el-input>
                    </div>
              </el-form-item>
                
           </el-row>
           <el-row v-if="search_lx1 == 3" style="display:flex;"> 
               <el-form-item label="好友区间" label-width="80px" >
                    <div style="display: flex;">
                        <el-input style="width:80px;" v-model.number="form.friend_min" placeholder=""></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input  style="width:80px;" v-model.number="form.friend_max" placeholder=""></el-input>
                    </div>
              </el-form-item>   
              <el-form-item label="团队区间" label-width="80px" >
                    <div style="display: flex;">
                        <el-input style="width:80px;" v-model.number="form.team_min" placeholder="" disabled></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input  style="width:80px;" v-model.number="form.team_max" placeholder="" disabled></el-input>
                    </div>
              </el-form-item>         
           </el-row>

        <div class="buttoon_box">
            <div class="buttoon_box_item"  style="margin-left:10px;background:#FFC600;color:white;" @click="search_but1()">确 定</div>
            <div class="buttoon_box_item" style="margin-left:10px;border:1px solid #D9D9D9;" @click="sx_but()">清 空</div>    
        </div>

    </div>
    


    <div style="display:flex;">
         <el-form-item  label="筛选项" label-width="60px">
              <el-select  v-model="search_lx2" placeholder="请选择搜索"  style="width:140px;">
                  <el-option  v-for="(item,index) in select_data_type2" :key="index" :label="item.name" :value="item.id"></el-option>
              </el-select>
          </el-form-item> 
          <el-row v-if="search_lx2 == 1" style="display:flex;margin-left:10px;">
               <el-form-item  label="活跃用户" >
                  <el-select  v-model="form.active_people" placeholder="活跃用户"  style="width:140px;">
                      <el-option  v-for="(item,index) in select_data_type3" :key="index" :label="item.name" :value="item.id"></el-option>
                  </el-select>
                </el-form-item> 
          </el-row>
          <el-row v-if="search_lx2 == 2" style="display:flex;margin-left:10px;"> 
                <el-form-item label="权限筛选" >
                <el-input v-model="form.jurisdiction" placeholder="" style="width:140px;" disabled></el-input>
              </el-form-item>
          </el-row>


        <div class="buttoon_box">
            <div class="buttoon_box_item"  style="margin-left:10px;background:#FFC600;color:white;" @click="search_but2()">确 定</div>
            <div class="buttoon_box_item" style="margin-left:10px;border:1px solid #D9D9D9;" @click="sx_but()">清 空</div>    
        </div>

    </div>

    


   </el-form>


    <!-- 渲染数据list -->
    <consumer-list :consumerdata="consumerdata" @up_list_fun="list_fun"> </consumer-list >

        
    <div style="margin-top:20px;text-align: center;">
        <el-pagination
          background
          @current-change="handleCurrentChange"
          :page-size="10"  
          layout="prev, pager, next, jumper"
          :total="count">
        </el-pagination>
      </div>



    
  </div>
</template>

<script>
import ConsumerList from '@/view/Consumer/ConsumerList'
export default {
  name: 'moban',
  data () {
    return {
        consumerdata:[],
        page:1,
        count:0,
        form:{
            phone:'',
            select_num:'',
            kmb_min:'',
            kmb_max:'',
            gdb_min:'',
            gdb_max:'',
            friend_min:'',
            friend_max:'',
            team_min:'',
            team_max:'',
            active_people:'',

            jz1:'', //金赚
            jz2:'', //金赚 
            jurisdiction:'', //权限筛选
            cy1:'', //持有
            cy2:'', //持有
            cc1:'', //产出
            cc2:''  //产出
        },
        search_btn_num:0,  //第几种搜索
        search_mode:0,  //第几种搜索中第几项
        
        select_data:[{"id":0,"name":"用户"},{"id":1,"name":"推荐人"}],

        
        search_lx1:1,
        select_data_type1:[{"id":1,"name":"用户类别"},{"id":2,"name":"积分查询"},{"id":3,"name":"团队查询"}],
        
        search_lx2:1,
        select_data_type2:[{"id":1,"name":"活跃用户"},{"id":2,"name":"权限筛选"}],

        select_data_type3:[{"id":0,"name":"不是活跃用户"},{"id":1,"name":"是活跃用户"}]
    }
  },
 components:{
    ConsumerList,
  },
  created(){
    

    this.list_fun()
  },
  mounted (){
    
  },
  methods: {
      list_fun(){
          this.post("/member/listOfData", {
              page:this.page,
              search_btn_num:this.search_btn_num,
              search_mode:this.search_mode,
              recommend:this.form.select_num,
              telOrName:this.form.phone,
              kmb_min:this.form.kmb_min,
              kmb_max:this.form.kmb_max,
              gdb_min:this.form.gdb_min,
              gdb_max:this.form.gdb_max,
              friend_min:this.form.friend_min,
              friend_max:this.form.friend_max,
              team_min:this.form.team_min,
              team_max:this.form.team_max,
              yesOrNo:this.form.active_people
	        }).then(res => {
            this.count = res.result.count
            this.consumerdata = res.result.list

              for(let item of this.consumerdata) {
               
                for(let a of item.qr_code) {
                   if(a.collection_type == 1){
                      item.srcListwx = a.collection_picture
                      item.srcList1 = [this.urlimg + a.collection_picture]
                   }else if(a.collection_type == 2){
                      item.srcListzfb = a.collection_picture
                      item.srcList2 = [this.urlimg + a.collection_picture]
                   }else if(a.collection_type == 3){
                      item.srcListysf = a.collection_picture
                      item.srcList3 = [this.urlimg + a.collection_picture]
                   }else if(a.collection_type == 4){
                      item.srcListjh = a.collection_picture
                      item.srcList4 = [this.urlimg + a.collection_picture]
                   }else if(a.collection_type == 5){
                      item.srcListyhk = a.collection_picture
                      item.srcList5 = [this.urlimg + a.collection_picture]
                   }
                }

                item.tx_picture = [this.urlimg + item.head_img]
                      
              }


            console.log(res)
         })
      },
      search_but1(){
           this.search_btn_num = 1
           this.search_mode = this.search_lx1

           this.form.active_people = ''

           this.page = 1
           this.list_fun()
      },
       search_but2(){
          this.search_btn_num = 2
          this.search_mode = this.search_lx2
          
          this.form.phone = ''
          this.form.select_num = ''
          this.form.kmb_min = ''
          this.form.kmb_max = ''
          this.form.gdb_min = ''
          this.form.gdb_max = ''
          this.form.friend_min = ''
          this.form.friend_max = ''
          this.form.team_min = ''
          this.form.team_max = ''

          this.page = 1
          this.list_fun()
      },
      sx_but(){
          this.search_btn_num = 0
          this.search_lx1 = 1
          this.search_lx2 = 1
          this.form={
            phone:'',
            select_num:'',
            kmb_min:'',
            kmb_max:'',
            gdb_min:'',
            gdb_max:'',
            friend_min:'',
            friend_max:'',
            team_min:'',
            team_max:'',
            active_people:'',

            jz1:'', //金赚
            jz2:'', //金赚 
            jurisdiction:'', //权限筛选
            cy1:'', //持有
            cy2:'', //持有
            cc1:'', //产出
            cc2:''  //产出
         }
          this.page = 1
          this.list_fun()
     },
     handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
.buttoon_box{
  display:flex;margin-bottom:10px;
}
.buttoon_box_item{
  height:40px;line-height:40px;width:60px;font-size:14px;text-align:center;border-radius:5px;
}
.el-input-box>>>input{
  padding: 0px 3px !important;
}
</style>
